<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        @keyframes move {
            0% {
                transform: rotateY(0deg);
            }

            100% {
                transform: rotateY(180deg);
            }

        }

        .box {
            position: relative;
            width: 300px;
            height: 300px;
            margin: 100px auto;
            /* transition: all 1s ease-in-out; */
            animation: move 3s infinite alternate;
            transform-style: preserve-3d;
        }

        /* 
        .box:hover {
            transform: rotateY(180deg);
        } */

        .front,
        .back {
            position: absolute;
            top: 0;
            left: 0;
            text-align: center;
            font-size: 30px;
            line-height: 300px;
            border-radius: 50%;
            width: 100%;
            height: 100%;
            color: white;
        }

        .front {
            background-color: red;

        }

        .back {
            background-color: purple;
            backface-visibility: hidden;
            transform: rotateY(180deg);
        }

        a {
            position: fixed;
            right: 50%;
            bottom: 5%;
            text-decoration: none;
            color: #000;
        }

        a:hover {
            color: red;
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="front">我的名字</div>
        <div class="back">欢迎您</div>
    </div>
    <div>
        <a href="首页.html">返回首页</a>

    </div>
    <script>
       const user = JSON.parse(localStorage.getItem('user'))
        if (!user) {
            window.location.href = '登录.html' 
        }
        const front = document.querySelector('.front')
        front.innerHTML = `${user[0].username}`
    </script>
</body>

</html>